<template>
	<view class="page-wapper">
		<view class="title2">
			累计收益:{{info.lecturer_sy}}
		</view>
		<view class="title1">
			<view class="page-content">
						<view class="item" v-for="i in state.data">
							<view class="top ss-flex ss-row-between">
								<view class="title">
									{{i.memo}}
								</view>
								<view class="amount" >
									{{i.amount}}
								</view>
							</view>
							<view class="bot  ss-flex ss-row-between">
								<view class="time">
									{{i.createtime}}
								</view>
								<!-- <view class="time">
									交易后余额:{{i.back_money}}
								</view> -->
							</view>
						</view>
					</view>
		</view>
	</view>
</template>

<script setup>
	import {
		computed,
		reactive,
		ref,
		onMounted,
		getCurrentInstance,
		nextTick
	} from 'vue';
	import {
		onLoad,
		onReady,
		onReachBottom
	} from '@dcloudio/uni-app'
	import LC from '@/LC'
	let state = reactive({
	
		pageData: {
			page: 1,
			limit:15,
			status: 'loading'
		},
		tabindex:0,
	
		data: []
	})
	let list1 = [{
			name: '资金',
			mode:1
		},
		{
			name: '黄金',
			mode:2
		},
		{
			name: '黄金券',
			mode:3
		}
	]
	
	
	onReachBottom(() => {
		onbottom()
	})
	let info = computed(() => LC.$store('user').info)
	
	onLoad(({
		type
	}) => {
	
		onbottom()
	
	})
	
	function onbottom() {
	
		let {
			status,
			load,
			limit,
			page
		} = state.pageData
	
		if (status != 'nomore' && !load) {
	
			getmsg()
	
	
		}
	}
	function tabchange({index}){
		state.tabindex=index
		state.pageData={
			page: 1,
			limit:15,
			status: 'loading'
		}
			state.data=[]
		
		data: []
		getmsg()
	}
	
	function getmsg() {
	
		LC.$api.user.commissionlog({...state.pageData,type:'articlesell'})
			.then(({
				res,
				data
			}) => {
	
	
				state.data = [...state.data, ...data.data]
	
				if (data.data.length < state.pageData.limit) {
					state.pageData.status = 'nomore'
					return
				}
	
	
				state.pageData.status = 'loadmore'
				state.pageData.page += 1
	
			})
	
	}
	
</script>

<style lang="scss">
	
	.item {
		background: #fafafa;
		// border-radius: 15rpx;
		border-bottom:2rpx solid #999999;
		padding: 19rpx;
		margin-bottom: 20rpx;
	
		.top {
	
			.title {
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 27rpx;
				color: #333333;
			}
	
			.status {
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 23rpx;
	
				line-height: 32rpx;
	
				&.sh {
					color: #FC5652;
				}
	
				&.fail {
					color: #E93030;
				}
	
				&.success {
					color: #999;
				}
			}
		}
	
		.bot {
			margin-top: 8rpx;
	
			.time {
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 23rpx;
				color: #999999;
				line-height: 32rpx;
			}
	
			.amount {
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 27rpx;
				color: #333333;
				line-height: 38rpx;
			}
		}
	}
	
.page-wapper{
	padding: 20rpx 30rpx;
	.title2{
		padding: 25rpx 20rpx;
		background-color: #e5e5e5;
		border-radius: 20rpx;
	}
}
</style>
